/**
 * (c) 2006 JOVEN
 * 
 * http://www.joven.com.cn
 */
package me.cloudcat.develop.entity.configuration;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import me.cloudcat.develop.entity.BaseEntity;

/**
 * 
 * @author ZZWang
 * @Time 2017年1月17日 下午2:39:18
 *
 */
@Entity
@Table(name = "tbl_user", uniqueConstraints = { @UniqueConstraint(columnNames = "username") })
//@SequenceGenerator(name = "SEQ_STORE", sequenceName = "TBL_USER_ID_ASQ", allocationSize = 1)
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
public class User extends BaseEntity<User> {

	private static final long serialVersionUID = 8380098780579946048L;


	/**
	 * username
	 */
	@NotNull
	private String username;

	/**
	 * passwort
	 */
	@NotNull
	private String password;

	/**
	 * version
	 */
	@Version
	private int version;

	/**
	 * login allowed
	 */
	private Integer loginAllowed = 1;

	/**
	 * Comment
	 */
	@Column(name = "remark")
	private String comment;

	@ManyToOne(fetch = FetchType.EAGER)
	private Person person;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public Integer getLoginAllowed() {
		return loginAllowed;
	}

	public void setLoginAllowed(Integer loginAllowed) {
		this.loginAllowed = loginAllowed;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

}
